//
//  NetHelper.h
//  Etion
//
//  Created by  user on 11-3-4.
//  Copyright 2011 GuangZhouXuanWu. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "RequestChannel.h"

#define CANCELNETHELPERREQUEST      @"CNHR"

@class XMSSimpleDownloadHelper;

@protocol XMSSimpleDownloadHelperDelegate <XMSDataOperationManagerDelegate>

- (void)simpleDownloadHelperWillStartConnect:(XMSSimpleDownloadHelper*)helper;

- (void)simpleDownloadHelperDidStartConnect:(XMSSimpleDownloadHelper*)helper;

- (void)simpleDownloadHelperFinishLoading:(XMSSimpleDownloadHelper*)helper;

- (void)simpleDownloadHelper:(XMSSimpleDownloadHelper*)helper error:(NSError*)error;

@optional
- (void)simpleDownloadHelperCancelRequest:(XMSSimpleDownloadHelper*)helper;

- (void)simpleDownloadHelper:(XMSSimpleDownloadHelper*)helper fileTotalSize:(long long)totalSize;

- (void)simpleDownloadHelper:(XMSSimpleDownloadHelper*)helper fileTotalSize:(long long)totalSize fileWrittenSize:(long long)writtenSize;

- (NSString*)simpleDownloadHelper:(XMSSimpleDownloadHelper*)helper needTransferURL:(NSString*)URL;

@end

@interface XMSSimpleDownloadHelper : CRequestChannel

@property(nonatomic, readonly) NSString *urlString;
@property(nonatomic, readonly) NSString *filePath;
@property(nonatomic, retain) id attachment;
@property(nonatomic, assign) id <XMSSimpleDownloadHelperDelegate> delegate;

- (id)initWithUrl:(NSString *)urlStr path:(NSString *)filePathStr delegate:(id)delegate;

- (BOOL)startReceiveWaitUntilDone;

@end
